package com.buss.purchase.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.buss.base.model.Branch;
import com.buss.core.dic.BillType;
import com.buss.core.dic.CheckStatus;

/**
 * 采购退货单
 * @author gykl
 *
 */
@Entity
@Table(name = "purchase_returnmaster")
@TableGenerator(name="pcReturnMaster_pk_sequence",initialValue=1,allocationSize=1,pkColumnName="seq_col",
	pkColumnValue="return_seq",valueColumnName="seq_val",table="purchase_pk_sequence")
public class PurchaseReturnMaster implements Serializable {

	private static final long serialVersionUID = 6697270268082129050L;

	/**表主键*/
	@Id
	@GeneratedValue(strategy=GenerationType.TABLE,generator="pcReturnMaster_pk_sequence")
	private Long id;
	
	/**仓库信息*/
	@ManyToOne(cascade=CascadeType.REFRESH,optional=false)
	@JoinColumn(name="branchId",nullable=false)
	private Branch branch;
	
	/**往来单位编码*/
	@Column(nullable=false)
	private Long customerId;
	
	/**往来单位名称*/
	@Column(length=200,nullable=false)
	private String customerName;
	
	/**业务员编码*/
	@Column(nullable=false)
	private Long salesId;
	
	/**业务员名称*/
	@Column(nullable=false,length=20)
	private String salesName;
	
	/**采购退货单号*/
	@Column(nullable=false,length=20)
	private String returnNumber;
	
	/**退货时间*/
	@Temporal(value=TemporalType.DATE)
	private Date returnDate;
	
	/**票据类型*/
	@Enumerated(value=EnumType.STRING)
	@Column(length=20,nullable=false)
	private BillType billType;
	
	/**合计金额*/
	@Column(nullable=false,scale=2)
	private Float amount;
	
	/**折让额*/
	@Column(nullable=false,scale=2)
	private Float allOwance;
	
	/**应收款*/
	@Column(nullable=false,scale=2)
	private Float receiving;
	
	/**审核状态*/
	@Enumerated(value = EnumType.STRING)
	@Column(nullable=false,length=20)
	private CheckStatus checkStatus;
	
	/**审核用户编码*/
	private Long checkUserId;
	
	/**审核用户名*/
	@Column(length=20)
	private String checkUserName;
	
	/**审核时间*/
	@Temporal(value=TemporalType.TIMESTAMP)
	private Date checkDate;
	
	/**录入用户编码*/
	@Column(nullable=false)
	private Long createUserId;
	
	/**录入用户名称*/
	@Column(nullable=false,length=20)
	private String createUserName;
	
	/**录入时间*/
	@Temporal(value=TemporalType.TIMESTAMP)
	@Column(nullable=false)
	private Date createDate;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Branch getBranch() {
		return branch;
	}

	public void setBranch(Branch branch) {
		this.branch = branch;
	}

	public Long getCustomerId() {
		return customerId;
	}

	public void setCustomerId(Long customerId) {
		this.customerId = customerId;
	}

	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public Long getSalesId() {
		return salesId;
	}

	public void setSalesId(Long salesId) {
		this.salesId = salesId;
	}

	public String getSalesName() {
		return salesName;
	}

	public void setSalesName(String salesName) {
		this.salesName = salesName;
	}

	public String getReturnNumber() {
		return returnNumber;
	}

	public void setReturnNumber(String returnNumber) {
		this.returnNumber = returnNumber;
	}

	public Date getReturnDate() {
		return returnDate;
	}

	public void setReturnDate(Date returnDate) {
		this.returnDate = returnDate;
	}

	public BillType getBillType() {
		return billType;
	}

	public void setBillType(BillType billType) {
		this.billType = billType;
	}

	public Float getAmount() {
		return amount;
	}

	public void setAmount(Float amount) {
		this.amount = amount;
	}

	public Float getAllOwance() {
		return allOwance;
	}

	public void setAllOwance(Float allOwance) {
		this.allOwance = allOwance;
	}

	public Float getReceiving() {
		return receiving;
	}

	public void setReceiving(Float receiving) {
		this.receiving = receiving;
	}

	public CheckStatus getCheckStatus() {
		return checkStatus;
	}

	public void setCheckStatus(CheckStatus checkStatus) {
		this.checkStatus = checkStatus;
	}

	public Long getCheckUserId() {
		return checkUserId;
	}

	public void setCheckUserId(Long checkUserId) {
		this.checkUserId = checkUserId;
	}

	public String getCheckUserName() {
		return checkUserName;
	}

	public void setCheckUserName(String checkUserName) {
		this.checkUserName = checkUserName;
	}

	public Date getCheckDate() {
		return checkDate;
	}

	public void setCheckDate(Date checkDate) {
		this.checkDate = checkDate;
	}

	public Long getCreateUserId() {
		return createUserId;
	}

	public void setCreateUserId(Long createUserId) {
		this.createUserId = createUserId;
	}

	public String getCreateUserName() {
		return createUserName;
	}

	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
}
